pub struct Defer{
    f:Option<Box<dyn FnOnce()->()>>,
}

impl Defer {
    pub fn new(f:Box<dyn FnOnce()->()>) -> Self {
        Defer{f:Some(f)}
    }
}

impl Drop for Defer {
    fn drop(&mut self) {
        self.f.take().unwrap()();
    }
}